<%@ page import="java.util.List"%>
<%@ page import="wdn.shared.Guests"%>
<%@ page import="com.google.appengine.api.users.UserService"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>

<%
List<Guests> guests = (List<Guests>)request.getAttribute("guests");
%>

<html>
<head>
<title>Guests list</title>
<link rel="stylesheet" type="text/css" href="/stylesheets/styles.css"/>
<script type="text/javascript" language="javascript" src="adm1/adm1.nocache.js"></script>
</head>

<body>
<% UserService userService = UserServiceFactory.getUserService();
if (!userService.isUserLoggedIn()) {
%>
Please <a href="<%=userService.createLoginURL("/admin")%>">log in</a>
<% } else { %>
Welcome, <%= userService.getCurrentUser().getNickname() %>!
  (<a href="<%=userService.createLogoutURL("/")%>">log out</a>)
<%
}
%>
<span class="nav"><a href="/Wdn.html">Home</a></span><p/>
<span class="title">Guests Display</span><p/>

<% if (guests.size() > 0) { %>
<p/><span class="heading">List:</span><br><p/>
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">
<tr bgcolor="#407BA8">
<td style="color: #ffffff; font-weight: bold;">Name</td>
<td style="color: #ffffff; font-weight: bold;">Key</td>
<td style="color: #ffffff; font-weight: bold;">E-Mail</td>
<td style="color: #ffffff; font-weight: bold;">4 Sep</td>
<td style="color: #ffffff; font-weight: bold;">12 Sep</td>
<td style="color: #ffffff; font-weight: bold;">Del</td>
</tr>
<% for (int i = 0;i<guests.size();i++) { %>
<% Guests g = (Guests)guests.get(i); %>
<tr style="background:#ffffff" onMouseOver="this.style.background='#eeeeee';" onMouseOut="this.style.background='#ffffff';">
<td nowrap><%= g.getName() %></td>
<td>$<%= g.getHash() %></td>
<td><%= g.getEmail() %></td>
<td><%= g.getSep4() %></td>
<td><%= g.getSep12() %></td>
<td id="row<%=g.getHash()%>"></td>
</tr>
<% } %>
</table>
<% } else { %>
<p/><span class="heading">No Guests found </span>
<% } %>
<span class="nav"><a href="/addguest.jsp"><p id="new_guest">Add Guest</a></span><p/>

</body>
</html>